package com.yshkj.payment.dto;

import com.yshkj.payment.entity.Privilege;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 唐旭 on 2016/9/28.
 */
public class AccountMenuItemDto {
    //菜单图标
    private String icon;
    //菜单连接地址
    private String url;
    //菜单显示名称
    private String label;

    private List<AccountMenuItemDto> subMenu = new ArrayList<>();

    public AccountMenuItemDto() {
    }

    public AccountMenuItemDto(Privilege privilege) {
        this.icon = privilege.getIcon();
        this.url = privilege.getUrl();
        this.label = privilege.getLabel();
        List<Privilege> subPrivileges = privilege.getSubPrivileges();
        if (subPrivileges != null && !subPrivileges.isEmpty()) {
            for (Privilege subPrivilege : subPrivileges) {
                subMenu.add(new AccountMenuItemDto(subPrivilege));
            }
        }
    }

    public String getIcon() {
        return icon;
    }

    public AccountMenuItemDto setIcon(String icon) {
        this.icon = icon;
        return this;
    }

    public String getUrl() {
        return url;
    }

    public AccountMenuItemDto setUrl(String url) {
        this.url = url;
        return this;
    }

    public String getLabel() {
        return label;
    }

    public AccountMenuItemDto setLabel(String label) {
        this.label = label;
        return this;
    }

    public List<AccountMenuItemDto> getSubMenu() {
        return subMenu;
    }

    public AccountMenuItemDto setSubMenu(List<AccountMenuItemDto> subMenu) {
        this.subMenu = subMenu;
        return this;
    }
}
